home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / QuickDraw 3D / Windows files / Q3WinSDK.exe / QD3DSDK / Interfaces / QD3DDrawContext.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-20  |  14.9 KB  |  484 lines

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DDrawContext.h                                         **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:    Draw context class types and routines                        **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1993-1996 Apple Computer, Inc. All rights reserved.     **
  11.  **                                                                          **
  12.  **                                                                          **
  13.  *****************************************************************************/
  14. #ifndef QD3DDrawContext_h
  15. #define QD3DDrawContext_h
  16.  
  17. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  18.     #pragma once
  19. #endif  /*  PRAGMA_ONCE  */
  20.  
  21. #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  22.  
  23. #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  24.     #pragma options enum=small
  25. #endif
  26.     #include <Quickdraw.h>
  27.     #include <FixMath.h>
  28.     #include <GXTypes.h>
  29. #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  30.     #pragma options enum=reset
  31. #endif
  32.  
  33. #endif /* WINDOW_SYSTEM_MACINTOSH */
  34.  
  35. #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  36.     #include <X11/Xlib.h>
  37.     #include <X11/Xutil.h>
  38. #endif /* WINDOW_SYSTEM_X11 */
  39.  
  40. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  41.     #include <windows.h>
  42. /******************************************************************************
  43.  *                                                                             **
  44.  * ABOUT   QD3D_NO_DIRECTDRAW:     (Win32 Only)                                 **
  45.  *                                                                             **
  46.  * NOTE: Define QD3D_NO_DIRECTDRAW for your application makefile/project     **
  47.  *       only if you don't need Q3DDSurfaceDrawContext support and don't     **
  48.  *       have access to ddraw.h.                                             ** 
  49.  *                                                                             **
  50.  *****************************************************************************/
  51. #if !defined(QD3D_NO_DIRECTDRAW)
  52.     #include <ddraw.h>
  53. #endif /* !QD3D_NO_DIRECTDRAW */
  54. #endif  /*  WINDOW_SYSTEM_WIN32  */
  55.  
  56. #if defined(THINK_C) || defined(__SC__)
  57.     #pragma options(!pack_enums, !align_arrays)
  58.     #pragma SC options align=power
  59. #elif defined(__MWERKS__)
  60.     #pragma enumsalwaysint on
  61.     #pragma align_array_members off
  62.     #pragma options align=native
  63. #elif defined(__PPCC__)
  64.     #pragma options align=power
  65. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  66.     #pragma options enum=int
  67. #endif
  68.  
  69. #ifdef __cplusplus
  70. extern "C" {
  71. #endif /*  __cplusplus  */
  72.  
  73.  
  74. /******************************************************************************
  75.  **                                                                             **
  76.  **                            DrawContext Data Structures                         **
  77.  **                                                                             **
  78.  *****************************************************************************/
  79.  
  80. typedef enum TQ3DrawContextClearImageMethod{
  81.     kQ3ClearMethodNone,
  82.     kQ3ClearMethodWithColor
  83. } TQ3DrawContextClearImageMethod;
  84.  
  85.  
  86. typedef struct TQ3DrawContextData {
  87.     TQ3DrawContextClearImageMethod    clearImageMethod;
  88.     TQ3ColorARGB                    clearImageColor;
  89.     TQ3Area                            pane;
  90.     TQ3Boolean                        paneState;
  91.     TQ3Bitmap                        mask;
  92.     TQ3Boolean                        maskState;
  93.     TQ3Boolean                        doubleBufferState;
  94. } TQ3DrawContextData;
  95.  
  96.  
  97. /******************************************************************************
  98.  **                                                                             **
  99.  **                                DrawContext Routines                         **
  100.  **                                                                             **
  101.  *****************************************************************************/
  102.  
  103. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3DrawContext_GetType(
  104.     TQ3DrawContextObject        drawContext);
  105.  
  106. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetData(
  107.     TQ3DrawContextObject        context,
  108.     const TQ3DrawContextData    *contextData);
  109.  
  110. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetData(
  111.     TQ3DrawContextObject        context,
  112.     TQ3DrawContextData            *contextData);
  113.     
  114. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetClearImageColor(
  115.     TQ3DrawContextObject        context,
  116.     const TQ3ColorARGB             *color);
  117.  
  118. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetClearImageColor(
  119.     TQ3DrawContextObject        context,
  120.     TQ3ColorARGB                 *color);
  121.  
  122. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetPane(
  123.     TQ3DrawContextObject        context,
  124.     const TQ3Area                 *pane);
  125.  
  126. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetPane(
  127.     TQ3DrawContextObject        context,
  128.     TQ3Area                         *pane);
  129.  
  130. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetPaneState(
  131.     TQ3DrawContextObject        context,
  132.     TQ3Boolean                    state);
  133.  
  134. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetPaneState(
  135.     TQ3DrawContextObject        context,
  136.     TQ3Boolean                    *state);
  137.         
  138. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetClearImageMethod(
  139.     TQ3DrawContextObject            context,
  140.     TQ3DrawContextClearImageMethod     method);
  141.         
  142. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetClearImageMethod(
  143.     TQ3DrawContextObject            context,
  144.     TQ3DrawContextClearImageMethod     *method);
  145.         
  146. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetMask(
  147.     TQ3DrawContextObject        context,
  148.     const TQ3Bitmap                *mask);
  149.         
  150. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetMask(
  151.     TQ3DrawContextObject        context,
  152.     TQ3Bitmap                    *mask);
  153.  
  154. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetMaskState(
  155.     TQ3DrawContextObject        context,
  156.     TQ3Boolean                    state);
  157.  
  158. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetMaskState(
  159.     TQ3DrawContextObject        context,
  160.     TQ3Boolean                    *state);
  161.  
  162. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetDoubleBufferState(
  163.     TQ3DrawContextObject        context,
  164.     TQ3Boolean                     state);
  165.  
  166. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetDoubleBufferState(
  167.     TQ3DrawContextObject        context,
  168.     TQ3Boolean                     *state);
  169.  
  170.  
  171. /******************************************************************************
  172.  **                                                                             **
  173.  **                            Pixmap Data Structure                             **
  174.  **                                                                             **
  175.  *****************************************************************************/
  176.  
  177. typedef struct TQ3PixmapDrawContextData {
  178.     TQ3DrawContextData        drawContextData;
  179.     TQ3Pixmap                pixmap;
  180. } TQ3PixmapDrawContextData;
  181.  
  182.  
  183. /******************************************************************************
  184.  **                                                                             **
  185.  **                        Pixmap DrawContext Routines                             **
  186.  **                                                                             **
  187.  *****************************************************************************/
  188.  
  189. QD3D_EXPORT TQ3DrawContextObject QD3D_CALL Q3PixmapDrawContext_New(
  190.     const TQ3PixmapDrawContextData    *contextData);
  191.  
  192. QD3D_EXPORT TQ3Status QD3D_CALL Q3PixmapDrawContext_SetPixmap(
  193.     TQ3DrawContextObject            drawContext,
  194.     const TQ3Pixmap                    *pixmap);
  195.  
  196. QD3D_EXPORT TQ3Status QD3D_CALL Q3PixmapDrawContext_GetPixmap(
  197.     TQ3DrawContextObject            drawContext,
  198.     TQ3Pixmap                        *pixmap);
  199.  
  200. #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  201.  
  202. /******************************************************************************
  203.  **                                                                             **
  204.  **                        Macintosh DrawContext Data Structures                 **
  205.  **                                                                             **
  206.  *****************************************************************************/
  207.  
  208. typedef enum TQ3MacDrawContext2DLibrary {
  209.     kQ3Mac2DLibraryNone,
  210.     kQ3Mac2DLibraryQuickDraw,
  211.     kQ3Mac2DLibraryQuickDrawGX
  212. } TQ3MacDrawContext2DLibrary;
  213.  
  214.  
  215. typedef struct TQ3MacDrawContextData {
  216.     TQ3DrawContextData            drawContextData;
  217.     CWindowPtr                    window;
  218.     TQ3MacDrawContext2DLibrary    library;
  219.     gxViewPort                    viewPort;
  220.     CGrafPtr                    grafPort;
  221. } TQ3MacDrawContextData;
  222.  
  223.  
  224. /******************************************************************************
  225.  **                                                                             **
  226.  **                        Macintosh DrawContext Routines                         **
  227.  **                                                                             **
  228.  *****************************************************************************/
  229.  
  230. QD3D_EXPORT TQ3DrawContextObject QD3D_CALL Q3MacDrawContext_New(
  231.     const TQ3MacDrawContextData    *drawContextData);
  232.     
  233. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_SetWindow(
  234.     TQ3DrawContextObject        drawContext,
  235.     const CWindowPtr            window);
  236.  
  237. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_GetWindow(
  238.     TQ3DrawContextObject        drawContext,
  239.     CWindowPtr                    *window);
  240.  
  241. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_SetGXViewPort(
  242.     TQ3DrawContextObject        drawContext,
  243.     const gxViewPort            viewPort);
  244.  
  245. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_GetGXViewPort(
  246.     TQ3DrawContextObject        drawContext,
  247.     gxViewPort                    *viewPort);
  248.  
  249. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_SetGrafPort(
  250.     TQ3DrawContextObject        drawContext,
  251.     const CGrafPtr                grafPort);
  252.  
  253. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_GetGrafPort(
  254.     TQ3DrawContextObject        drawContext,
  255.     CGrafPtr                    *grafPort);
  256.  
  257. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_Set2DLibrary(
  258.     TQ3DrawContextObject        drawContext,
  259.     TQ3MacDrawContext2DLibrary    library);
  260.  
  261. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_Get2DLibrary(
  262.     TQ3DrawContextObject        drawContext,
  263.     TQ3MacDrawContext2DLibrary    *library);
  264.  
  265. #endif /* WINDOW_SYSTEM_MACINTOSH */
  266.  
  267. #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  268.  
  269. /******************************************************************************
  270.  **                                                                             **
  271.  **                                Types                                         **
  272.  **                                                                             **
  273.  *****************************************************************************/
  274.  
  275. typedef struct TQ3XBufferData *TQ3XBufferObject;
  276.  
  277. typedef struct TQ3XColormapData {
  278.     long        baseEntry;
  279.     long        maxRed;
  280.     long        maxGreen;
  281.     long        maxBlue;
  282.     long        multRed;
  283.     long        multGreen;
  284.     long        multBlue;
  285. } TQ3XColormapData;
  286.  
  287.  
  288. typedef struct TQ3XDrawContextData {
  289.     TQ3DrawContextData        contextData;
  290.     Display                    *display;
  291.     Drawable                drawable;
  292.     Visual                    *visual;
  293.     Colormap                cmap;
  294.     TQ3XColormapData        *colorMapData;
  295. } TQ3XDrawContextData;
  296.  
  297.  
  298. /******************************************************************************
  299.  **                                                                             **
  300.  **                            XDrawContext Routines                             **
  301.  **                                                                             **
  302.  *****************************************************************************/
  303.  
  304. #ifdef XDC_OLD
  305. QD3D_EXPORT TQ3DrawContextObject QD3D_CALL Q3XDrawContext_New(
  306.     void);
  307.  
  308. QD3D_EXPORT void QD3D_CALL Q3XDrawContext_Set(
  309.     TQ3DrawContextObject    drawContext,
  310.     unsigned long            flag,                             
  311.     void                    *data);
  312.  
  313. QD3D_EXPORT void QD3D_CALL Q3XDrawContext_Get(
  314.     TQ3DrawContextObject    drawContext,
  315.     unsigned long            flag,                             
  316.     void                    *data);
  317. #endif  /* XDC_OLD */
  318.  
  319. QD3D_EXPORT TQ3XBufferObject QD3D_CALL Q3XBuffers_New(
  320.     Display                    *dpy,                       
  321.     unsigned long            numBuffers,
  322.     Window                    window);
  323.  
  324. QD3D_EXPORT void QD3D_CALL Q3XBuffers_Swap(
  325.     Display                    *dpy,
  326.     TQ3XBufferObject        buffers);
  327.  
  328. QD3D_EXPORT XVisualInfo *QD3D_CALL Q3X_GetVisualInfo(
  329.     Display                    *dpy,
  330.     Screen                    *screen);
  331.  
  332.  
  333. QD3D_EXPORT TQ3DrawContextObject QD3D_CALL Q3XDrawContext_New(
  334.     const TQ3XDrawContextData    *xContextData);
  335.  
  336. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_SetDisplay(
  337.     TQ3DrawContextObject        drawContext,
  338.     const Display                *display);
  339.  
  340. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_GetDisplay(
  341.     TQ3DrawContextObject        drawContext,
  342.     Display                        **display);
  343.  
  344. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_SetDrawable(
  345.     TQ3DrawContextObject        drawContext,
  346.     Drawable                    drawable);
  347.  
  348. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_GetDrawable(
  349.     TQ3DrawContextObject        drawContext,
  350.     Drawable                    *drawable);
  351.  
  352. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_SetVisual(
  353.     TQ3DrawContextObject        drawContext,
  354.     const Visual                *visual);
  355.  
  356. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_GetVisual(
  357.     TQ3DrawContextObject        drawContext,
  358.     Visual                        **visual);
  359.  
  360. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_SetColormap(
  361.     TQ3DrawContextObject        drawContext,
  362.     Colormap                    colormap);
  363.  
  364. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_GetColormap(
  365.     TQ3DrawContextObject        drawContext,
  366.     Colormap                    *colormap);
  367.  
  368. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_SetColormapData(
  369.     TQ3DrawContextObject        drawContext,
  370.     const TQ3XColormapData        *colormapData);
  371.  
  372. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_GetColormapData(
  373.     TQ3DrawContextObject        drawContext,
  374.     TQ3XColormapData            *colormapData);
  375.  
  376. #endif /* WINDOW_SYSTEM_X11 */
  377.  
  378. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  379.  
  380. /******************************************************************************
  381.  **                                                                             **
  382.  **                                Types                                         **
  383.  **                                                                             **
  384.  *****************************************************************************/
  385.  
  386. typedef struct TQ3Win32DCDrawContextData {
  387.     TQ3DrawContextData        drawContextData;
  388.     HDC                        hdc;
  389. } TQ3Win32DCDrawContextData;
  390.  
  391. #if !defined(QD3D_NO_DIRECTDRAW)
  392.  
  393. typedef enum {
  394.     kQ3DirectDrawObject        = 1,
  395.     kQ3DirectDrawObject2    = 2
  396. } TQ3DirectDrawObjectSelector;
  397.  
  398. typedef enum {
  399.     kQ3DirectDrawSurface    = 1,
  400.     kQ3DirectDrawSurface2    = 2
  401. } TQ3DirectDrawSurfaceSelector;
  402.  
  403. typedef struct TQ3DDSurfaceDescriptor {
  404.     TQ3DirectDrawObjectSelector        objectSelector;
  405.     union
  406.     {
  407.         LPDIRECTDRAW                lpDirectDraw;
  408.         LPDIRECTDRAW2                lpDirectDraw2;
  409.     };
  410.  
  411.     TQ3DirectDrawSurfaceSelector    surfaceSelector;
  412.     union
  413.     {
  414.         LPDIRECTDRAWSURFACE            lpDirectDrawSurface;
  415.         LPDIRECTDRAWSURFACE2        lpDirectDrawSurface2;
  416.     };
  417. } TQ3DDSurfaceDescriptor;
  418.  
  419. typedef struct TQ3DDSurfaceDrawContextData {
  420.     TQ3DrawContextData                drawContextData;
  421.     TQ3DDSurfaceDescriptor            ddSurfaceDescriptor;
  422. } TQ3DDSurfaceDrawContextData;
  423.  
  424. #endif /* !QD3D_NO_DIRECTDRAW */
  425.  
  426. /******************************************************************************
  427.  **                                                                             **
  428.  **                            Win32DC DrawContext Routines                     **
  429.  **                                                                             **
  430.  *****************************************************************************/
  431.  
  432. QD3D_EXPORT TQ3DrawContextObject QD3D_CALL Q3Win32DCDrawContext_New(
  433.     const TQ3Win32DCDrawContextData    *drawContextData);
  434.  
  435. QD3D_EXPORT TQ3Status QD3D_CALL Q3Win32DCDrawContext_SetDC(
  436.     TQ3DrawContextObject        drawContext,
  437.     const HDC                    hdc);
  438.  
  439. QD3D_EXPORT TQ3Status QD3D_CALL Q3Win32DCDrawContext_GetDC(
  440.     TQ3DrawContextObject        drawContext,
  441.     HDC                            *hdc);
  442.  
  443.  
  444. /******************************************************************************
  445.  **                                                                             **
  446.  **                            DDSurface DrawContext Routines                     **
  447.  **                                                                             **
  448.  *****************************************************************************/
  449. #if !defined(QD3D_NO_DIRECTDRAW)
  450.  
  451. QD3D_EXPORT TQ3DrawContextObject QD3D_CALL Q3DDSurfaceDrawContext_New(
  452.     const TQ3DDSurfaceDrawContextData    *drawContextData);
  453.  
  454. QD3D_EXPORT TQ3Status QD3D_CALL Q3DDSurfaceDrawContext_SetDirectDrawSurface(
  455.     TQ3DrawContextObject            drawContext,
  456.     const TQ3DDSurfaceDescriptor    *ddSurfaceDescriptor);
  457.  
  458. QD3D_EXPORT TQ3Status QD3D_CALL Q3DDSurfaceDrawContext_GetDirectDrawSurface(
  459.     TQ3DrawContextObject        drawContext,
  460.     TQ3DDSurfaceDescriptor        *ddSurfaceDescriptor);
  461.  
  462. #endif /* !QD3D_NO_DIRECTDRAW */
  463.  
  464. #endif  /*  WINDOW_SYSTEM_WIN32  */
  465.  
  466.  
  467. #ifdef __cplusplus
  468. }
  469. #endif /*  __cplusplus  */
  470.  
  471. #if defined(THINK_C) || defined(__SC__)
  472.     #pragma SC options align=reset
  473. #elif defined(__MWERKS__)
  474.     #pragma enumsalwaysint reset
  475.     #pragma align_array_members reset
  476.     #pragma options align=reset
  477. #elif  defined(__PPCC__)
  478.     #pragma options align=reset
  479. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  480.     #pragma options enum=reset
  481. #endif
  482.  
  483. #endif  /*  QD3DDrawContext_h  */
  484.